/*
 * @Author: your name
 * @Date: 2021-08-30 17:01:49
 * @LastEditTime: 2021-08-30 18:35:53
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \briup\5-javascript\day06\10-最大差值.js
 */

var arr = [10, 5, 11, 7, 8, 9]

function compare(v1, v2) {
    return v1 - v2;
}
arr.sort(compare);
var arr1 = arr;
//console.log(arr1);
// var a = arr1[0];
// var b = arr[arr.length - 1];
console.log(arr[arr.length - 1] - arr[0]);